package com.zhkj.txg.module.member.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.lib.utils.SpanUtil
import com.zhkj.txg.R
import com.zhkj.txg.module.member.entity.RebateLogEntity

class MemberRebateAdapter : BaseQuickAdapter<RebateLogEntity, BaseViewHolder>(R.layout.item_member_rebate),
    LoadMoreModule {
    override fun convert(helper: BaseViewHolder, item: RebateLogEntity) {
        val textView = helper.setText(R.id.tvRebateType, item.remark)
            .setText(R.id.tvRebateDate, String.format(context.getString(R.string.pay_time), item.createTime))
            .setText(R.id.tvRebatePrice, SpanUtil.setMoneySymbol(item.money))
            .setText(
                R.id.tvRebateSource,
                context.getString(if (item.source == 10) R.string.member_type_share else R.string.member_type_down)
            ).setText(
                R.id.tvRebateStatus,
                context.getString(if (item.status == 0) R.string.member_not_rebate else R.string.member_rebate)
            ).getView<TextView>(R.id.tvRebateStatus)
        textView.isSelected = item.status == 1
    }
}